﻿//------------------------------------------------------------------------------
// <copyright file="Tests.cs" company="Robert MacLean">
//      Copyright © Robert MacLean.  All Rights Reserved.
// </copyright>
//
//  Details on this see: http://pepper.codeplex.com
//  This code released under the terms of the 
//  Microsoft Public License  (MS-PL, http://opensource.org/licenses/ms-pl.html.)
//------------------------------------------------------------------------------

namespace Pepper.LitterBox
{
    using System;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using Pepper.Core;
    using Pepper.Forms;

    [TestClass]
    public class Tests
    {
        [TestMethod]
        [TestCategory("Forms")]
        public void MainFormTest()
        {
            var mainWindow = new MainWindow();
            mainWindow.ShowDialog();
        }

        [TestMethod]
        [TestCategory("Services")]
        public void LoginTest()
        {
            var result = Settings.Login("robert@sadev.co.za", "pass");
            Assert.IsTrue(result != Guid.Empty);
        }

        [TestMethod]
        [TestCategory("Services")]
        public void UploadTest()
        {
            var userid = Settings.Login("robert@sadev.co.za", "pass");
            Settings.UploadSettings(userid, "pass", "".PadRight(50000, '-'));
        }

        [TestMethod]
        [TestCategory("Services")]
        public void FullExportUploadTest()
        {
            var userid = Settings.Login("robert@sadev.co.za", "pass");
            Settings.SaveSettings(userid, "pass");
        }

        [TestMethod]
        [TestCategory("Services")]
        public void DownloadSettingsTest()
        {
            var userid = Settings.Login("robert@sadev.co.za", "pass");
            var result = Settings.DownloadSettings(userid, "pass");
            Assert.IsNotNull(result);
            //Assert.AreEqual("".PadRight(50000, '-'), result);
        }

        [TestMethod]
        [TestCategory("AUth")]
        public void AuthTest()
        {
            var result = AuthenticationPrompt.PromptForPassword();
            Assert.AreEqual("user", result.Item1);
            Assert.AreEqual("pass", result.Item2);
        }
    }
}


